package cn.pugle.oj.leetcode;

import cn.pugle.oj.catalog.DynamicProblem;

/**
 * TODO 也不行
 *
 * @author tzp
 * @since 2020/9/16
 */
public class LC375_2 implements DynamicProblem {
    public int getMoneyAmount(int n) {
        if (n <= 1) return 0;
        int[][] state = new int[n + 1][n + 1];
        state[1][1] = 0;
        state[1][2] = 1;

        for (int i = 3; i <= n; i++) {
            //i=3这轮, 把2-3 1-3处理了
            //i=4这轮, 吧3-4 2-4 1-4处理了
            for (int j = i - 1; j >= 1; j--) {
                if (i - j == 1) {
                    state[j][i] = j;
                } else if (i - j == 2) {
                    state[j][i] = j + 1;
                } else {

                }
            }
        }
        return state[1][n];
    }

    public static void main(String[] args) {
        System.out.println(new LC375_2().getMoneyAmount(16));
    }
}
